var echarts = require("echarts");

//整车订单生产情况
let chartLeft1 = {
  title: {},
  tooltip: {
    trigger: "axis",
    axisPointer: {
      type: "shadow",
      label: {
        backgroundColor: "#6a7985"
      }
    }
  },

  color: ["#ffab6f", "#09b916"], //图例颜色
  legend: {
    top: "0%",
    icon: "roundRect",
    data: ["本年", "本月"],
    textStyle: {
      color: "rgba(255,255,255,.5)",
      fontSize: "12"
    }
  },
  toolbox: {
    feature: {}
  },
  grid: {
    left: "10",
    top: "10",
    right: "10",
    bottom: "10",
    containLabel: true
  },
  xAxis: [
    {
      type: "category",
      axisLabel: {
        textStyle: {
          color: "rgba(255,255,255,.6)",
          fontSize: 12
        }
      },
      axisLine: {
        lineStyle: {
          color: "rgba(255,255,255,.2)"
        }
      },
      data: [
        "下订",
        "排产",
        "下线",
        "发车"
      ],
      nameTextStyle: {
        borderwith: '2000px',
        color: '#fac858'
      },
      axisLabel: {
        width: 20
      }
    }
  ],
  yAxis: [
    {
      type: "value",
      axisTick: { show: false },
      minInterval: 10,
      axisLine: {
        lineStyle: {
          color: "rgba(255,255,255,.1)"
        }
      },
      axisLabel: {
        textStyle: {
          color: "rgba(255,255,255,.6)",
          fontSize: 12
        }
      },

      splitLine: {
        lineStyle: {
          color: "rgba(255,255,255,.1)"
        }
      }
    }
  ],
  series: [
    {
      name: "本年",
      type: "bar",
      smooth: true,
      barWidth: '20%',
      data: []
      /* data: [502, 220, 150, 540] */
    },
    {
      name: "本月",
      type: "bar",
      smooth: true,
      barWidth: '20%',
      data: []
      /* data: [100, 1500, 100, 2500] */
    },
  ],
  label: {
    show: 'true',
    color: '#fff',
    fontSize: 12,
    verticalAlign: 'top',
  }
};

// 接单台数
let chartLeft3 = {
  title: {},
  tooltip: {
    trigger: "axis",
    axisPointer: {
      type: "shadow",
      label: {
        backgroundColor: "#6a7985"
      }
    }
  },
  color: ["#ffab6f", "#09b916"], //图例颜色
  legend: {
    top: "0%",
    icon: "roundRect",
    data: ["往年", "本年"],
    textStyle: {
      color: "rgba(255,255,255,.5)",
      fontSize: "12"
    }
  },
  toolbox: {
    feature: {}
  },
  grid: {
    left: "10",
    top: "10",
    right: "10",
    bottom: "10",
    containLabel: true
  },
  xAxis: [
    {
      type: "category",
      axisLabel: {
        textStyle: {
          color: "rgba(255,255,255,.6)",
          fontSize: 12
        }
      },
      axisLine: {
        lineStyle: {
          color: "rgba(255,255,255,.2)"
        }
      },
      data: [],
      nameTextStyle: {
        borderwith: '2000px',
        color: '#fac858'
      },
      axisLabel: {
        width: 20
      }
    }
  ],
  yAxis: [
    {
      type: "value",
      axisTick: { show: false },
      minInterval: 10,
      axisLine: {
        lineStyle: {
          color: "rgba(255,255,255,.1)"
        }
      },
      axisLabel: {
        textStyle: {
          color: "rgba(255,255,255,.6)",
          fontSize: 12
        }
      },

      splitLine: {
        lineStyle: {
          color: "rgba(255,255,255,.1)"
        }
      }
    }
  ],
  series: [
    {
      name: "往年",
      type: "line",
      smooth: true,
      barWidth: '20%',
      data: [],
      /* data: [502, 220, 150, 540] */
    },
    {
      name: "本年",
      type: "line",
      smooth: true,
      barWidth: '20%',
      data: []
      /* data: [100, 1500, 100, 2500] */
    }
  ],
};

//整车订单销售情况
let pieInvoice = {
  tooltip: {
    trigger: 'item'
  },
  legend: {
    orient: 'horizontal',
    left: 'left',
    top: 'bottom',
    textStyle: {
      color: '#ffffff'
    }
  },
  series: [
    {
      name: '整车销量',
      type: 'pie',
      radius: '50%',
      avoidLabelOverlap: false,
      data: [],
      label: {
        show: true,
        overflow: 'truncate',
        position: 'outside',
        formatter: '{b}:\n{c}辆',
        rotate: 'true',
        color: 'inherit',
        alignTo: 'lableLine',
        fontSize: 12,
        moveOverlap: 'shiftX'
      },
      avoidLabelOverlap: true
    }
  ]
};

//各部门回款总金额
let piePaymentback = {
  tooltip: {
    trigger: 'item',
  },
  legend: {
    top: '5%',
    left: 'left',
    textStyle: {
      color: '#d3d3d3'
    }
  },
  series: [
    {
      name: '回款金额',
      type: 'pie',
      radius: '40%',
      data: [],
      label: {
        show: true,
        overflow: 'truncate',
        position: 'outside',
        formatter: '{b}\n{c}万元',
        rotate: 'true',
        color: 'inherit',
        alignTo: 'lableLine',
        fontSize: 12,
        moveOverlap: 'shiftX'
      },
      avoidLabelOverlap: true
    }
  ]
};

//返利情况分析
let lineRebate = {
  title: {},
  tooltip: {
    trigger: "axis",
    axisPointer: {
      type: "shadow",
      label: {
        backgroundColor: "#6a7985"
      }
    }
  },
  color: ["#ffab6f", "#09b916"],
  legend: {
    top: "0%",
    icon: "roundRect",
    data: ["返利兑现", "返利使用"],
    textStyle: {
      color: "rgba(255,255,255,.5)",
      fontSize: "12"
    }
  },
  toolbox: {
    feature: {}
  },
  grid: {
    left: "10",
    top: "10",
    right: "10",
    bottom: "10",
    containLabel: true
  },
  xAxis: [
    {
      type: "category",
      axisLabel: {
        textStyle: {
          color: "rgba(255,255,255,.6)",
          fontSize: 12
        }
      },
      axisLine: {
        lineStyle: {
          color: "rgba(255,255,255,.2)"
        }
      },
      data: [],
      nameTextStyle: {
        borderwith: '2000px',
        color: '#fac858'
      },
      axisLabel: {
        width: 20
      }
    }
  ],
  yAxis: [
    {
      type: "value",
      axisTick: { show: false },
      minInterval: 10,
      axisLine: {
        lineStyle: {
          color: "rgba(255,255,255,.1)"
        }
      },
      axisLabel: {
        textStyle: {
          color: "rgba(255,255,255,.6)",
          fontSize: 12
        }
      },

      splitLine: {
        lineStyle: {
          color: "rgba(255,255,255,.1)"
        }
      }
    }
  ],
  series: [
    {
      name: "返利兑现",
      type: "line",
      smooth: true,
      barWidth: '20%',
      data: []
    },
    {
      name: "返利使用",
      type: "line",
      smooth: true,
      barWidth: '20%',
      data: []
    }
  ],
};

let chartRight1 = {
  title: {
    text: ""
  },
  tooltip: {
    trigger: "axis",
    axisPointer: {
      type: "cross",
      label: {
        backgroundColor: "#6a7985"
      }
    }
  },

  color: ["#ffab6f", "#09b916", "#83cddc"], //图例颜色
  legend: {
    top: "0%",
    icon: "roundRect",
    data: ["销售订单", "退货订单", "折扣订单"],
    textStyle: {
      color: "rgba(255,255,255,.5)",
      fontSize: "12"
    }
  },
  toolbox: {
    feature: {}
  },
  grid: {
    left: "10",
    top: "20",
    right: "10",
    bottom: "10",
    containLabel: true
  },
  xAxis: [
    {
      type: "category",
      boundaryGap: false,
      axisLabel: {
        textStyle: {
          color: "rgba(255,255,255,.6)",
          fontSize: 12
        }
      },
      axisLine: {
        lineStyle: {
          color: "rgba(255,255,255,.2)"
        }
      },
      data: [
        "2020.06.15",
        "2020.06.16",
        "2020.06.17",
        "2020.06.18",
        "2020.06.19",
        "2020.06.20",
        "2020.06.21",
        "2020.06.22"
      ]
    }
  ],
  yAxis: [
    {
      type: "value",
      axisTick: { show: false },
      minInterval: 60,
      axisLine: {
        lineStyle: {
          color: "rgba(255,255,255,.1)"
        }
      },
      axisLabel: {
        textStyle: {
          color: "rgba(255,255,255,.6)",
          fontSize: 12
        }
      },

      splitLine: {
        lineStyle: {
          color: "rgba(255,255,255,.1)"
        }
      }
    }
  ],
  series: [
    {
      name: "销售订单",
      type: "line",
      smooth: true,
      lineStyle: {
        color: "#45d4ba",
        width: 1
      }, //线条的样式
      areaStyle: {
        color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
          {
            offset: 0,
            color: "#83cddc"
          },
          {
            offset: 1,
            color: "#bfdffbb5"
          }
        ])
      },
      data: [5, 22, 150, 54, 1, 230, 4, 1]
    },
    {
      name: "退货订单",
      type: "line",

      smooth: true,
      lineStyle: {
        color: "#04a710",
        width: 1
      }, //
      areaStyle: {
        color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
          {
            offset: 0,
            color: "#0cbf22"
          },
          {
            offset: 1,
            color: "#b8f7d1b5"
          }
        ])
      },
      data: [10, 150, 1, 250, 20, 100, 10, 150]
    },
    {
      name: "折扣订单",
      type: "line",

      lineStyle: {
        color: "#0864c3",
        width: 1
      }, //线条的样式
      smooth: true,
      areaStyle: {
        color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
          {
            offset: 0,
            color: "#29d7ff"
          },
          {
            offset: 1,
            color: "#34ccef85"
          }
        ])
      },
      data: [100, 2, 260, 1, 200, 30, 101, 40]
    }
  ]
};
//实销数量（按月）表
let chartRight2 = {
  title: {},//标题
  tooltip: {//柱状图添加阴影
    trigger: "axis",
    axisPointer: {
      type: "shadow",
      label: {
        backgroundColor: "#6a7985"
      }
    }
  },

  color: ["#ffab6f", "#09b916"], //柱状图颜色
  legend: {//图例
    top: "0%",
    icon: "roundRect",
    textStyle: {
      color: "rgba(255,255,255,.5)",
      fontSize: "12"
    }
  },
  toolbox: {
    feature: {}
  },
  grid: {//柱状图内容的布局
    left: "10",
    top: "10",
    right: "10",
    bottom: "10",
    containLabel: true//标签防遮挡
  },
  xAxis: [
    {
      type: "category",
      axisLabel: {
        textStyle: {
          color: "rgba(255,255,255,.6)",
          fontSize: 12
        }
      },
      axisLine: {//坐标轴线
        lineStyle: {
          color: "rgba(255,255,255,.2)"
        }
      },
      data: [
      ],
      nameTextStyle: {
        borderwith: '2000px',
        color: '#fac858'
      },
      axisLabel: {
        width: 20
      }
    }
  ],
  yAxis: [
    {
      type: "value",
      axisTick: { show: false },
      minInterval: 10,
      axisLine: {
        lineStyle: {
          color: "rgba(255,255,255,.1)"
        }
      },
      axisLabel: {
        textStyle: {
          color: "rgba(255,255,255,.6)",
          fontSize: 12
        }
      },

      splitLine: {
        lineStyle: {
          color: "rgba(255,255,255,.1)"
        }
      }
    }
  ],
  series: [
    {
      type: "bar",
      smooth: true,
      barWidth: '20%',
      data: []
    }
  ],
  label: {
    show: 'true',
    color: '#fff',
    fontWeight: 'bold',
    fontSize: 12,
    verticalAlign: 'top',
    position: 'top',
  }
};
export { chartLeft1, pieInvoice, chartLeft3, chartRight1, chartRight2, piePaymentback, lineRebate }
